//
//  XCIconTableViewCell.m
//  SoundOfNature
//
//  Created by 梁新昌 on 16/3/8.
//  Copyright © 2016年 梁新昌. All rights reserved.
//

#import "XCIconTableViewCell.h"

@implementation XCIconTableViewCell
- (void)dealloc {
    [_rankButton release];
    [_rankLable release];
    [_songListButton release];
    [_songListLable release];
    [_radioButton release];
    [_radioLable release];
    [_singerButton release];
    [_singerLable release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.rankButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.rankButton.frame = CGRectZero;
        [self.rankButton setImage:[[UIImage imageNamed:@"Image-rank"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        self.rankLable = [[XCBaseLable alloc] initWithFrame:CGRectZero];
        self.rankLable.text = @"排行榜";
        [self.contentView addSubview:self.rankLable];
        [self.contentView addSubview:self.rankButton];
        
        self.songListButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.songListButton.frame = CGRectZero;
        [self.songListButton setImage:[[UIImage imageNamed:@"Image-songList"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        self.songListLable = [[XCBaseLable alloc] initWithFrame:CGRectZero];
        self.songListLable.text = @"歌单";
        [self.contentView addSubview:self.songListLable];
        [self.contentView addSubview:self.songListButton];
        
        self.radioButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.radioButton.frame = CGRectZero;
        [self.radioButton setImage:[[UIImage imageNamed:@"Image-radio"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        self.radioLable = [[XCBaseLable alloc] initWithFrame:CGRectZero];
        self.radioLable.text = @"电台";
        [self.contentView addSubview:self.radioLable];
        [self.contentView addSubview:self.radioButton];
        
        self.singerButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.singerButton.frame = CGRectZero;
        [self.singerButton setImage:[[UIImage imageNamed:@"Image-singer"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        self.singerLable = [[XCBaseLable alloc] initWithFrame:CGRectZero];
        self.singerLable.text = @"歌手";
        [self.contentView addSubview:self.singerLable];
        [self.contentView addSubview:self.singerButton];
        
        [_rankLable release];
        [_singerLable release];
        [_radioLable release];
        [_songListLable release];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.rankButton.frame = CGRectMake(self.bounds.size.width / 9 , 0, self.bounds.size.width / 9 , self.bounds.size.width / 9);
    self.rankLable.frame = CGRectMake(self.bounds.size.width / 9 , 2 + self.rankButton.frame.size.height, self.bounds.size.width / 9, 5);
    self.rankLable.textAlignment = NSTextAlignmentCenter;
    self.rankLable.font = [UIFont systemFontOfSize:10];
    self.songListButton.frame = CGRectMake(self.bounds.size.width * 3 / 9, 0, self.bounds.size.width / 9, self.bounds.size.width / 9);
    self.songListLable.frame = CGRectMake(self.bounds.size.width * 3 / 9, 2 + self.rankButton.frame.size.height, self.bounds.size.width / 9, 5);
    self.songListLable.textAlignment = NSTextAlignmentCenter;
    self.songListLable.font = [UIFont systemFontOfSize:10];
    self.radioButton.frame = CGRectMake(self.bounds.size.width * 5 / 9, 0, self.bounds.size.width / 9, self.bounds.size.width / 9);
    self.radioLable.frame = CGRectMake(self.bounds.size.width * 5 / 9, 2 + self.rankButton.frame.size.height, self.bounds.size.width / 9, 5);
    self.radioLable.textAlignment = NSTextAlignmentCenter;
    self.radioLable.font = [UIFont systemFontOfSize:10];
    self.singerButton.frame = CGRectMake(self.bounds.size.width * 7 / 9, 0, self.bounds.size.width / 9, self.bounds.size.width / 9);
    self.singerLable.frame = CGRectMake(self.bounds.size.width * 7 / 9, 2 + self.rankButton.frame.size.height, self.bounds.size.width / 9, 5);
    self.singerLable.textAlignment = NSTextAlignmentCenter;
    self.singerLable.font = [UIFont systemFontOfSize:10];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
